<?php 
App::Import('Vendor', 'tcpdf/tcpdf');
$tcpdf =  new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); 
$textfont = 'freesans';
$tcpdf->SetAutoPageBreak(true); 

$tcpdf->setPrintHeader(false);
$tcpdf->setPrintFooter(false);

$tcpdf->SetTextColor(0, 0, 0);
$tcpdf->SetFont($textfont, '', 10);
$tcpdf->AddPage();

foreach ($data as $key => $entry)
{
	$text = '<p><span style="font-size: 150%; font-weight: bold;">' . ($key + 1) . ". ";
	if (!empty($entry['Entry']['title']))
	{
		$text .= $entry['Entry']['title'] . "<br />";
	}
	$text .= "</span>";
	$text .= nl2br(trim($entry['Entry']['value'])) . "</p>";
	$tcpdf->writeHTML($text);
	$tcpdf->Ln();
}

$tcpdf->Output(date('Ymd-His-') . rand(0, 100) .  '.pdf', 'D');

?>